package entity;

public class UserServiceImpl {

  private Object dao;

  public UserServiceImpl() {
    System.out.println("---默认构造函数---");
  }

  public UserServiceImpl(UserDaoImpl dao) {
    System.out.println("---构造函数注入UserDaoImpl dao---");
    this.dao = dao;
  }

  public UserServiceImpl(BaseDao dao) {
    System.out.println("---构造函数注入BaseDao dao---");
    this.dao = dao;
  }

  public UserServiceImpl(UserDao dao) {
    System.out.println("---构造函数注入UserDao dao---");
    this.dao = dao;
  }

  public UserServiceImpl(Object dao) {
    System.out.println("---构造函数注入Object dao---");
    this.dao = dao;
  }

  public UserDao getDao() {
    return (UserDao) dao;
  }

  public void setDao(UserDao dao) {
    System.out.println("---属性注入dao---");
    this.dao = dao;
  }

  public void insert() {
    System.out.println("insert in UserServiceImpl---");
    ((UserDao) dao).insert();
  }

  public void m() {
    System.out.println("m in UserServiceImpl ------");
  }
}
